package com.lagou.rpc.consumer.controller;

import com.lagou.rpc.api.IUserService;
import com.lagou.rpc.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author 梅松
 * @Date 2021/9/4 15:45
 */
@Controller
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/user/{id}")
    public String user(Model model,@PathVariable("id") int id){
       User user = userService.getById(id);
       model.addAttribute("user",user);
       return "user";
    }
}
